package com.system.service.Impl;

import java.util.List;
import java.util.Map;

import com.system.dao.StudentMapper;
import com.system.entity.Student;
import com.system.service.studentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.CrossOrigin;

@CrossOrigin
@Service
public class StudentServiceImpl implements studentService {

	@Autowired
	private StudentMapper studentMapper;
	@Override
	public int add(Student student) {
		// TODO Auto-generated method stub
		return studentMapper.insert(student);
	}

	@Override
	public int edit(Student student) {
		// TODO Auto-generated method stub
		return studentMapper.updateByPrimaryKeySelective(student);
	}

	@Override
	public int delete(Long stu_id) {
		// TODO Auto-generated method stub
		return studentMapper.deleteByPrimaryKey(stu_id);
	}

	@Override
	public List<Student> findList(Map<String, Object> queryMap) {
		// TODO Auto-generated method stub
		return studentMapper.findList(queryMap);
	}

	@Override
	public List<Student> findAll() {
		// TODO Auto-generated method stub
		return studentMapper.findAll();
	}

	@Override
	public int getTotal(Map<String, Object> queryMap) {
		// TODO Auto-generated method stub
		return studentMapper.getTotal(queryMap);
	}

	@Override
	public Student findByStudentId(Long id) {
		return studentMapper.selectByPrimaryKey(id);
	}

	@Override
	public Student findByUserName(String stu_name) {
		// TODO Auto-generated method stub
		return studentMapper.findByUserName(stu_name);
	}

}
